{include file="public/header" /}
<div class="header">
	<span>演示列表-静态表格</span>
	<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
		<i class="layui-icon layui-icon-add-1"></i>添加
	</button>
	<div></div>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>ID</th>
			<th>文本</th>
			<th>富文本</th>
			<th>百度文本</th>
			<th>图片</th>
			<th>参照</th>
			<th>时间戳</th>
			<th>日期</th>
			<th>日期时间</th>
			<th>网址链接</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{volist name="lists" id='vo'}
			<tr>
				<td>{$vo['test_id']}</td>
				<td>{$vo['test_input']}</td>
				<td>{$vo['test_rich']}</td>
				<td>{$vo['test_rich_baidu']}</td>
				<td>
					<img style="width:30px;height:30px;" onmouseover="show_img(this)" onmouseleave="hide_img()" src="{$vo['test_img']}">
				</td>
				<td>
					{if($vo['test_reference'] == 1)}
						<span style="color:green;">开启</span>
					{else/}
						<span style="color:grey;">关闭</span>
					{/if}
				</td>
				<td>{:date('Y-m-d H:i:s',$vo.test_time)}</td>
				<td>{$vo['test_data']}</td>
				<td>{$vo['test_datatime']}</td>
				<td><a href="{$vo['test_url']}" target="_blank">{$vo['test_url']}</a></td>
				<td>
					<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$vo.test_id})">
						<i class="layui-icon layui-icon-edit"></i>编辑
					</button>
					<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del({$vo.test_id})">
						<i class="layui-icon layui-icon-delete"></i>删除
					</button>
				</td>
			</tr>
		{/volist}
	</tbody>
</table>
<div>{$lists|raw}</div>
<script type="text/javascript">
	layui.use(['layer'],function(){
		layer = layui.layer;
		$ = layui.jquery;
	});
	// 添加
	function add(){
		layer.full(
			layer.open({
				type: 2,
				title: '添加',
				shade: 0.3,
				maxmin: true,
				area: ['450px','550px'],
				content: "{$config['admin_route']}Bewtest/test_static_add"
			})
		);
	}
	// 编辑
	function edit(test_id){
		layer.full(layer.open({
			type: 2,
			title: '编辑',
			shade: 0.3,
			area: ['450px','550px'],
			content: "{$config['admin_route']}Bewtest/test_static_edit?test_id="+test_id
		}));
	}
	// 删除
	function del(test_id){
		layer.confirm('确定要删除吗？', {
			icon:3,
			btn: ['确定','取消']
		}, function(){
		  $.post("{$config['admin_route']}Bewtest/test_del",{'test_id':test_id},function(res){
				if(res.code>0){
					layer.alert(res.msg,{icon:2});
				}else{
					layer.msg(res.msg,{icon:1});
					setTimeout(function(){window.location.reload();},1000);
				}
		  },'json');
		});
	}
</script>
{include file="public/tail" /}